<!-- BEGIN NEWS FORM -->
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'categories-form',
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
	),
)); ?>
<div class="form-body">
    <div class="row">
        <div class="col-md-6">
            <div class="form-group <?php echo ($model->getError('title') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'title', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'title', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'title', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('brief') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'brief', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'brief', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'brief', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('position') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'position', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model, 'position', array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'position', array('class'=>'help-block')); ?>
            </div>

            <div class="form-group <?php echo ($model->getError('parent_id') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'parent_id', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'parent_id', CHtml::listData(Categories::model()->findAll('status="A"'), 'id', 'title', 'category.title'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'parent_id', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->getError('status') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model, 'status', array('class'=>'control-label')); ?>
                <?php echo $form->dropDownList($model, 'status', array('A'=>'Hoạt động', 'I'=>'Ngừng hoạt động'), array('class'=>'form-control')); ?>
                <?php echo $form->error($model, 'status', array('class'=>'help-block')); ?>
            </div>
        </div>
        <?php if (!empty($model->seotool)): ?>
        <div class="col-md-6">
            <div class="form-group <?php echo ($model->seotool->getError('title') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model->seotool, 'title', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model->seotool, 'title', array('class'=>'form-control')); ?>
                <?php echo $form->error($model->seotool, 'title', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->seotool->getError('description') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model->seotool, 'description', array('class'=>'control-label')); ?>
                <?php echo $form->textArea($model->seotool, 'description', array('class'=>'form-control', 'rows'=>5)); ?>
                <?php echo $form->error($model->seotool, 'description', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($model->seotool->getError('keywords') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($model->seotool, 'keywords', array('class'=>'control-label')); ?>
                <?php echo $form->textField($model->seotool, 'keywords', array('class'=>'form-control')); ?>
                <?php echo $form->error($model->seotool, 'keywords', array('class'=>'help-block')); ?>
            </div>
        </div>
        <?php else: ?>
        <div class="col-md-6">
            <div class="form-group <?php echo ($seotool->getError('title') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($seotool, 'title', array('class'=>'control-label')); ?>
                <?php echo $form->textField($seotool, 'title', array('class'=>'form-control')); ?>
                <?php echo $form->error($seotool, 'title', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($seotool->getError('description') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($seotool, 'description', array('class'=>'control-label')); ?>
                <?php echo $form->textArea($seotool, 'description', array('class'=>'form-control', 'rows'=>5)); ?>
                <?php echo $form->error($seotool, 'description', array('class'=>'help-block')); ?>
            </div>
            
            <div class="form-group <?php echo ($seotool->getError('keywords') ? 'has-error' : ''); ?>">
                <?php echo $form->labelEx($seotool, 'keywords', array('class'=>'control-label')); ?>
                <?php echo $form->textField($seotool, 'keywords', array('class'=>'form-control')); ?>
                <?php echo $form->error($seotool, 'keywords', array('class'=>'help-block')); ?>
            </div>
        </div>
        <?php endif; ?>
    </div>
</div>
<div class="form-actions right">
	<button type="reset" class="btn default">Cancel</button>
	<button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> <?php echo $model->isNewRecord ? 'Tạo mới' : 'Cập nhật thông tin'; ?></button>
</div>
<?php $this->endWidget(); ?>
<!-- END NEWS FORM -->